package com.itheima;

import cn.hutool.core.io.FileUtil;
import com.itheima.utils.AliyunOSSOperator;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;


import java.io.File;

@SpringBootTest
public class testOssAliyun {
    @Autowired
    private AliyunOSSOperator aliyunOSSOperator;
    @Test
    //1.上传图片返回图片的url
    public void testUpload() throws Exception{
        File f=new File("C:\\Users\\ch200\\Pictures\\4.jpg");
        String url = aliyunOSSOperator.upload(FileUtil.readBytes(f), f.getName());
        System.out.println(url);
    }

}
